 {
        
        var o = require("../../UIManager/UISoundManager.js");
        cc.Class({
            extends: cc.Component,
            properties: {
                nodeOtherPlayerResult1: {
                    default: null,
                    type: cc.Node
                },
                nodeOtherPlayerResult2: {
                    default: null,
                    type: cc.Node
                },
                nodeOtherPlayerResult3: {
                    default: null,
                    type: cc.Node
                },
                coinSp: {
                    default: null,
                    type: cc.Sprite
                },
                labWinNum: {
                    default: null,
                    type: cc.Label
                },
                labLoseNum: {
                    default: null,
                    type: cc.Label
                },
                labTotalFan: {
                    default: null,
                    type: cc.Label
                },
                labFan: {
                    default: null,
                    type: cc.Sprite
                },
                listViewContent: {
                    default: null,
                    type: cc.Node
                },
                nodeGameResultListItem: {
                    default: null,
                    type: cc.Prefab
                },
                spBg: {
                    default: null,
                    type: cc.Sprite
                },
                spWinFanTitleLeft: {
                    default: null,
                    type: cc.Sprite
                },
                spWinFanTitleRight: {
                    default: null,
                    type: cc.Sprite
                },
                nodeGameResultWinFly: {
                    default: null,
                    type: cc.Node
                },
                nodeGameResultLoseFly: {
                    default: null,
                    type: cc.Node
                },
                winFont: {
                    default: null,
                    type: cc.Font
                },
                loseFont: {
                    default: null,
                    type: cc.Font
                },
                nodeProgressTip: {
                    default: null,
                    type: cc.Node
                },
                nodeBottom: {
                    default: null,
                    type: cc.Node
                },
                lblBaoPayLeftNum: {
                    default: null,
                    type: cc.Label
                },
                lblDoublePayLeftNum: {
                    default: null,
                    type: cc.Label
                },
                _gameEndInfo: null,
                _gameEndInfoEx: null,
                _isError: !1
            },
            onLoad: function () {
                try {
                    Global.notificationCenter.on(Global.eventName.MSG_HAPPYBAG5, this.showProgressTip.bind(this), this),
                        Global.notificationCenter.on(Global.eventName.MSG_PAY_SHARE_RESULT, this.payResultHandler.bind(this), this),
                        Global.tableModel.getTableType() == Global.config.tableType.CREATE ? this.isShowChangeAndBack(!1) : this.isShowChangeAndBack(!0);
                    var e = this.node;
                    e.on(cc.Node.EventType.TOUCH_START, this.onTouchStart.bind(this), this), e.on(cc.Node.EventType.TOUCH_END, this.onTouchEnd.bind(this), this),
                        e.on(cc.Node.EventType.TOUCH_CANCEL, this.onTouchCancel.bind(this), this);
                    var t = Global.configCdn.getActivityAndTaskConf() || Global.configCdn.getDefaultConfig("activityAndTask");
                    this._redPacketkinds = t.redPacketkinds, this.initUI();
                } catch (e) {
                    console.error("NodeGameResultNewController error:", e), this._isError = !0;
                    var n = new Date(),
                        o = "NodeGameResultNewController userId:" + tywx.UserInfo.userId + "time:" + n.toDateString() + " " + n.toTimeString() + ";" + e.message;
                    tywx.BiLog.uploadLogTimely(o), this.onClickContinue();
                }
            },
            start: function () {
                Global.tableModel.getTableType() == Global.config.tableType.CREATE && (this.coinSp.spriteFrame = null),
                Global.roomInfoModel.getPlayModel() == Global.config.playModel.ERREN && (this.nodeOtherPlayerResult1.active = !1,
                    this.nodeOtherPlayerResult3.active = !1, this.nodeProgressTip.active = !1), Global.msgHandler.requestTaskData();
            },
            initUI: function () {
                var e = Global.tableModel.getPlayerModel(Global.config.SEAT_DOWN);
                this._baoLeftNum = e.getLosePaybackCount(), this._doubleLeftNum = e.getDoubleWinCount(),
                    this.lblBaoPayLeftNum.string = "今日剩余" + this._baoLeftNum + "次", this.lblDoublePayLeftNum.string = "今日剩余" + this._doubleLeftNum + "次",
                    this._showConfigUI = Global.configCdn.getUISwitch(), this._btnChange = Global.utils.searchNode(this.nodeBottom, "btnChange"),
                    this._btnContinue = Global.utils.searchNode(this.nodeBottom, "btnContinue"), this._baoPayLayout = Global.utils.searchNode(this.nodeBottom, "BaopayLayout"),
                    this._doublePayLayout = Global.utils.searchNode(this.nodeBottom, "RewardLayout"),
                    this._tip_content = Global.utils.searchNode(this.nodeBottom, "tip_content"), this._baoPayLayout.active = !1,
                    this._doublePayLayout.active = !1, this.hasBaoPay = !1, this.hasDoublePay = !1,
                    console.log("current version", this._baoLeftNum, this._doubleLeftNum, this._showConfigUI),
                    this._showConfigUI && Global.roomInfoModel.getNotZiZunOrFuHao() ? (console.log("current version is under check!"),
                        this._btnChange.active = !1, this._btnContinue.active = !1) : (this._btnChange.active = !0,
                        this._btnContinue.active = !0);
                e = Global.tableModel.getPlayerModel(Global.config.SEAT_DOWN);
                if (this.btnNewDoublePay = Global.utils.searchNode(this._doublePayLayout, "btnNewDoublePay"),
                    this.btnNewBaopay = Global.utils.searchNode(this._baoPayLayout, "btnNewBaopay"),
                    e.getDoubleWinByAD()) {
                    var t = Global.utils.searchNode(this.btnNewDoublePay, "New Sprite");
                    Global.spriteAtlas.setSpriteFrame(t.getComponent(cc.Sprite), "Texture/common", "AD_kanshipinshuangbei");
                } else {
                    t = Global.utils.searchNode(this.btnNewDoublePay, "New Sprite");
                    Global.spriteAtlas.setSpriteFrame(t.getComponent(cc.Sprite), "Texture/common", "TY_shuangbei");
                }
                e.getLosePayBackByAD() ? Global.spriteAtlas.setSpriteFrame(Global.utils.searchNode(this.btnNewBaopay, "New Sprite").getComponent(cc.Sprite), "Texture/common", "AD_kanshipinibaopei") : Global.spriteAtlas.setSpriteFrame(Global.utils.searchNode(this.btnNewBaopay, "New Sprite").getComponent(cc.Sprite), "Texture/common", "TY_xitong");
            },
            showFriendRoom: function () {
                if (Global.tableModel.getTableType() == Global.config.tableType.CREATE) {
                    this._btnChange.active = !1, this._baoPayLayout.active = !1, this._doublePayLayout.active = !1,
                        this._btnContinue.active = !0, this._btnContinue.setPosition(-27, -27);
                    var e = this._tip_content.getComponent(cc.Widget);
                    e && (e.isAlignLeft = !1, e.isAlignHorizontalCenter = !0, e.horizontalCenter = 0);
                }
            },
            showProgressTip: function (e) {
                console.log("showProgressTip result= ", e);
                var t = 1;
                Global.roomInfoModel.getPlayModel() == Global.config.playModel.ERREN && (t = 4);
                var n = Global.ActivityTaskModel.getActivitiesConfArrByIndex(t);
                if (console.log("showProgressTip configArr= ", n), e && n && n.length > 0 && "list" == e.action) {
                    for (var o = !1, i = null, a = null, r = 0; r < n.length; r++) {
                        a = n[r];
                        for (var s = 0; s < e.tasks.length; s++) {
                            var l = e.tasks[s];
                            if (l && a.kindId == l[1] && 0 == l[3]) {
                                o = !0, i = l;
                                break;
                            }
                        }
                        if (o) break;
                    }
                    if (o && null != i) {
                        this.nodeProgressTip.active = !0;
                        var c = Global.utils.searchComp(this.nodeProgressTip, "tip", cc.Label),
                            d = a.progressMax - i[2];
                        c.string = "再玩" + d + "局可领取" + a.reward + "金币！";
                    } else this.nodeProgressTip.active = !1;
                    this.onRefreshCompleteRedPacket(e);
                } else this.nodeProgressTip.active = !1;
            },
            onRefreshCompleteRedPacket: function (e) {
                var t = Global.configCdn.getUISwitchConf(), n = !1;
                if (t && t.isRookieManRedPacketTask && (n = t.isRookieManRedPacketTask || !1), 0 != n) {
                    var o = 0;
                    if (this._redPacketkinds) for (var i = 0; i < this._redPacketkinds.length; i++) for (var a = this._redPacketkinds[i], r = 0; r < e.tasks.length; r++) {
                        var s = e.tasks[r];
                        a.kindId == s[1] && 0 == i && ((o = a.progressMax - s[2]) > 0 ? Global.utils.showNodeCommon("再玩" + o + "局即可领取现金红包！", 3) : 1 == s[3] && Global.boolTipsRedPacket && (Global.utils.showNodeCommon("恭喜您已获得0.3元微信红包，请到大厅查看！", 3),
                            Global.boolTipsRedPacket = !1));
                    }
                } else cc.log("新手屏蔽+++config.isRookieManRedPacketTask");
            },
            onShowResult: function (e) {
                this.node.setScale(e), 0 == e ? Global.utils.showBanner(!1) : 1 == e && Global.utils.showBanner(!0, null, 0, 0);
            },
            onTouchStart: function (e) {
                this.onShowResult(0), e.stopPropagation();
            },
            onTouchEnd: function (e) {
                this.onShowResult(1), e.stopPropagation();
            },
            onTouchCancel: function (e) {
                this.onShowResult(1), e.stopPropagation();
            },
            isShowChangeAndBack: function (e) {
                Global.utils.searchNode(this.node, "btnClose").active = e, Global.utils.searchNode(this.node, "btnChange").active = e,
                !e && this.btnContinue && this.btnContinue.setPosition(-27, -27);
            },
            bindData: function (e) {
                if (this._isError) console.error("NodeGameResultNewController bindData error"); else {
                    this._gameEndInfo = e;
                    var t = Global.tableModel.getPlayerModel(Global.config.SEAT_DOWN);
                    t && (this._gameEndInfoEx = t.getDetailInfo()), this.refresh();
                }
            },
            refresh: function () {
                for (var e = !1, t = 0; t < this._gameEndInfo.infos.length; ++t) {
                    var n = this._gameEndInfo.infos[t], o = Global.tableModel.toLocalSeatIndex(n.seatId);
                    o == Global.config.SEAT_DOWN ? (n.totalScore >= 0 && (e = !0), this.refreshSelf(n)) : o == Global.config.SEAT_LEFT ? this.refreshOther(this.nodeOtherPlayerResult1, n) : o == Global.config.SEAT_UP ? this.refreshOther(this.nodeOtherPlayerResult2, n) : o == Global.config.SEAT_RIGHT && this.refreshOther(this.nodeOtherPlayerResult3, n);
                }
                if (this._gameEndInfoEx) {
                    var i = null, a = null;
                    for (t = 0; t < this._gameEndInfoEx.length; ++t) t % 2 == 0 && (i = cc.instantiate(this.nodeGameResultListItem),
                    this.listViewContent && this.listViewContent.addChild(i), a = i.getComponent("NodeGameResultListItemController")),
                    a && a.bindData(t % 2 + 1, this._gameEndInfoEx[t], e);
                }
            },
            refreshSelf: function (e) {
                var t = "-";
                e.totalScore >= 0 && (t = "+");
                if (e.totalFan >= 0 && "+", this.labTotalFan.font = this.loseFont, Global.spriteAtlas.setSpriteFrame(this.labFan, "Texture/gameResult", Global.utils.getUnit(!0, !1)),
                e.totalScore >= 0 && (this.labTotalFan.font = this.winFont, Global.spriteAtlas.setSpriteFrame(this.labFan, "Texture/gameResult", Global.utils.getUnit(!0, !0))),
                    this.labTotalFan.string = e.totalFan + "", this.labWinNum.string = "", this.labLoseNum.string = "",
                e.totalScore < 0) {
                    this.labLoseNum.string = e.totalScore + "", Global.spriteAtlas.setSpriteFrame(this.spBg, "Texture/gameResult", "JS_6"),
                        Global.spriteAtlas.setSpriteFrame(this.spWinFanTitleLeft, "Texture/gameResult", "JS_8"),
                        Global.spriteAtlas.setSpriteFrame(this.spWinFanTitleRight, "Texture/gameResult", "JS_8"),
                        this.nodeGameResultWinFly.active = !1, this.nodeGameResultLoseFly.active = !0;
                    var n = this.nodeGameResultLoseFly.getComponent(cc.Animation);
                    n.on("finished", function () {
                        n.play("shibai_xunhuan");
                    }.bind(this), this), this._showConfigUI && this._baoLeftNum > 0 && Global.roomInfoModel.getNotZiZunOrFuHao() ? (this.hasBaoPay = !0,
                        this._baoPayLayout.active = !0) : (this._btnChange.active = !0, this._btnContinue.active = !0),
                        this.showFriendRoom();
                } else {
                    this.labWinNum.string = t + e.totalScore + "", this.nodeGameResultWinFly.active = !0;
                    var o = this.nodeGameResultWinFly.getComponent(cc.Animation);
                    o.on("finished", function () {
                        o.play("shengli_xunhuan");
                    }.bind(this), this), this.nodeGameResultLoseFly.active = !1, this._showConfigUI && this._doubleLeftNum > 0 && Global.roomInfoModel.getNotZiZunOrFuHao() ? (this.hasDoublePay = !0,
                        this._doublePayLayout.active = !0) : (this._btnChange.active = !0, this._btnContinue.active = !0),
                        this.showFriendRoom();
                }
            },
            refreshOther: function (e, t) {
                var n = e.getComponent("NodeOtherPlayerResultController");
                n && n.bindData(t);
            },
            onClickBaoPay: function () {
                if (o.playEffect("select"), this.hasBaoPay && !(this._baoLeftNum <= 0)) {
                    var e = this, t = function (t) {
                        var n = !1;
                        t && (n = Global.utils_Share.checkOpenGId(t)), console.log("onClickBaoPay", t, n),
                            n ? Global.utils.showNodeCommon("换个群试试，不要频繁打扰同一个群哦！", 3) : (cc.warn("onClickBaoPay before"),
                                e.scheduleOnce(function () {
                                    cc.warn("onClickBaoPay after");
                                    Global.msgHandler.requestResultPay(0);
                                }, .2));
                    };
                    Global.tableModel.getPlayerModel(Global.config.SEAT_DOWN).getLosePayBackByAD() ? Global.utils.showViewAd(Global.config.adUnitId, t, function () {
                        Global.utils.showNodeCommon("您在播放中途退出，无法领取游戏奖励", 3);
                    }) : Global.utils_Share.shareToGroup(Global.config.sharePointId.Recoup, t);
                }
            },
            onClickDoublePay: function () {
                o.playEffect("select");
                var e = this;
                if (this.hasDoublePay && !(this._doubleLeftNum <= 0)) {
                    var t = function (t) {
                        var n = !1;
                        t && (n = Global.utils_Share.checkOpenGId(t)), console.log("onClickDoublePay", t, n),
                            n ? Global.utils.showNodeCommon("换个群试试，不要频繁打扰同一个群哦！", 3) : (cc.warn("onClickDoublePay before"),
                                e.scheduleOnce(function () {
                                    cc.warn("onClickDoublePay after");
                                    Global.msgHandler.requestResultPay(1);
                                }, .2));
                    };
                    Global.tableModel.getPlayerModel(Global.config.SEAT_DOWN).getDoubleWinByAD() ? Global.utils.showViewAd(Global.config.adUnitId, t, function () {
                        Global.utils.showNodeCommon("您在播放中途退出，无法领取游戏奖励", 3);
                    }) : Global.utils_Share.shareToGroup(Global.config.sharePointId.doubleBonus, t);
                }
            },
            payResultHandler: function (e) {
                cc.warn("*******payResultHandler********");
                var t = e.deltaChip;
                if (this._baoPayLayout.active) o.playReward(), this._baoLeftNum -= 1, this._baoLeftNum = this._baoLeftNum < 0 ? 0 : this._baoLeftNum,
                    this.lblBaoPayLeftNum.string = "今日剩余" + this._baoLeftNum + "次", this.btnNewBaopay.color = new cc.Color(165, 165, 165),
                    Global.utils.searchNode(this.btnNewBaopay, "New Sprite").getComponent(cc.Sprite).node.color = new cc.Color(165, 165, 165),
                    this.hasBaoPay = !1, Global.utils.showNodeCommon("系统为您承担了" + t + "金币损失\n今日还可包赔" + this._baoLeftNum + "次", 3); else if (this._doublePayLayout.active) {
                    o.playReward(), this._doubleLeftNum -= 1, this._doubleLeftNum = this._doubleLeftNum < 0 ? 0 : this._doubleLeftNum,
                        this.lblDoublePayLeftNum.string = "今日剩余" + this._doubleLeftNum + "次", this.btnNewDoublePay.color = new cc.Color(165, 165, 165),
                        Global.utils.searchNode(this.btnNewDoublePay, "New Sprite").getComponent(cc.Sprite).node.color = new cc.Color(165, 165, 165),
                        this.hasDoublePay = !1, Global.utils.showNodeCommon("系统额外奖励了" + t + "金币\n今日还可双倍" + this._doubleLeftNum + "次", 3);
                }
            },
            onClickChange: function () {
                o.playEffect("select"), Global.utils.showWaitting();
                Global.roomInfoModel.getPlayModel();
                var e = Global.roomInfoModel.getRoomId(), t = Global.tableModel.getTableId(),
                    n = Global.tableModel.getSeatId();
                Global.msgHandler.requestTableLeave(e, t, n), this.quickStart();
            },
            onClickContinue: function () {
                o.playEffect("select");
                if (Global.tableModel.getTableType() == Global.config.tableType.CREATE) if (Global.tableModel.getIsShowTotalResult()) {
                    var e = Global.tableModel.getTotalResult();
                    this.onShowTotalResult(e), this.node.active = !1;
                } else {
                    SceneHelper.loadScene("waittingScene", function () {
                        Global.utils.hideWaitting(), Global.msgHandler.requestNextRound(Global.tableModel.getRoomId(), Global.tableModel.getTableId(), Global.tableModel.getSeatId());
                    });
                } else this.quickStart();
            },
            onClickBack: function () {
                o.playEffect("select"), SceneHelper.loadScene("selectScene");
                var e = Global.tableModel.getRoomId(), t = Global.tableModel.getTableId(),
                    n = Global.tableModel.getSeatId();
                if (0 != e && 0 != t) return cc.error("WaittingController onClickBack", "roomId = " + e + " tableId = " + t + " seatId = " + n),
                    void Global.msgHandler.requestTableLeave(e, t, n);
            },
            quickStart: function () {
                Global.tableModel.setAllowPopupRotateLuckInGameEnd(!0);
                var e = {
                    playMode: Global.roomInfoModel.getPlayModel() || Global.config.playModel.XUELIU,
                    gameId: Global.config.GAMEID || Global.config.GAMEID_NORMAL,
                    roomId: Global.roomInfoModel.getRoomId(),
                    type: "NodeGameResultNewController quickStart"
                };
                Global.notificationCenter.emit(Global.eventName.MSG_DO_QUICK_START, e);
            },
            onDestroy: function () {
                Global.tableModel.setAllowPopupRotateLuckInGameEnd(!1), Global.notificationCenter.offAll(this);
            },
            onShowTotalResult: function (e) {
                cc.loader.loadRes("prefabs/nodeGameTotalResult", cc.Prefab, function (t, n) {
                    var i = cc.instantiate(n);
                    console.log("预制节点===", i);
                    var a = Global.utils.searchNode(SceneHelper.getCurScene(), "Node_result");
                    if (a && i) {
                        a.addChild(i, 10), i.setPosition(cc.p(0, 50));
                        var r = i.getComponent("GameTotalResultController");
                        console.log("controller ==", r), r.bindData(e), o.playGameEnd();
                    }
                });
            }
        })
    }